﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xant.FlowEngine.Interface;
using Xant.FlowEngine.Core;

namespace Xant.FlowEngine.Actor
{
    /// <summary>
    /// 部门参与者
    /// <remarks>该部门中所有员工都将获得参与权</remarks>
    /// </summary>
    public class DepartmentActor : AbstractActor
    {
        private IOrganization department;

        public DepartmentActor(IOrganization department)
        {
            this.department = department;
        }

        public override string Text
        {
            get { return department.FriendlyName; }
        }

        public override string ToXml()
        {
            var xml = string.Format("<Actor Type=\"{0}\" Key=\"{1}\" />", this.Type, department.Id);
            return xml;
        }

        public override IEnumerable<Interface.IStaffMember> GetStaffs()
        {
            return department.StaffMembers;
        }
    }
}
